package gui;

import java.awt.FlowLayout;
import javax.swing.*;
import server.TodoItem;

public class DisplayPanel extends JPanel{

        private JComboBox priority;
        private JTextField deadlineText;
        private JTextArea content;
        public DisplayPanel(TodoItem todo,int mode) {
            setLayout(new FlowLayout(FlowLayout.LEADING));
            JLabel labelType = new JLabel();
            if(mode==0){
                labelType.setText("Your item");
            }else if(mode==1){
                labelType.setText("Updated item");
            }else if(mode==2){
                labelType.setText("This item was modified. \nDo you still want to delete it");
            }
            
            add(labelType);
            
            JLabel priorityLabel = new JLabel("Priority");
            add(priorityLabel);

            priority = new JComboBox(new Integer[]{1,2,3});
            priority.setSelectedItem(todo.getPriority());
            priority.setEnabled(false);
            add(priority);

            JLabel deadlineLabel = new JLabel("Deadline");
            add(deadlineLabel);
            deadlineText = new JTextField(todo.getDeadline());
            deadlineText.setColumns(15);
            deadlineText.setEditable(false);
            add(deadlineText);

            content = new JTextArea(todo.getContent(),10,20);
            content.setEditable(false);
            JScrollPane scrollableContent = new JScrollPane(
                                    content, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            add(scrollableContent);
        }
        
    }
